<template>
    <el-menu
          :default-openeds= "['1', '3']"
          style= "height: 100%; width:100%"
          background-color= "#001529"
          text-color= "#96a1ab"
          active-text-color= "#ffffff"
          :collapse-transition= "false"
          :collapse= "isCollapse"
          router
          @select="handleRoute"
        >
          <div style= "height: 60px; line-height: 60px; text-align: center">
            <el-link href = "/home">
            <img src= "../assets/icon.png" style= "position: relative; margin-top: 20px; margin-right: 10px"/>
            </el-link>
            <el-link href = "/home" style= "color: #ffffff" v-show= "logoTextShow">
            <b>教学网站定制</b>
            </el-link>
          </div>
          <!-- <el-submenu>
          <template slot= "title"><i class= "el-icon-location"></i></template>
          <span slot= "title">首页</span>
          <el-menu-item index= "/home"><i class= "el-icon-location">首页</i></el-menu-item>
          </el-submenu> -->


          <div  v-for= "item in authorityList" :key = "item.authId">
            <!--有index是一级 权限，没index是二级权限-->
            <!--我这里只有二级权限-->
                <el-submenu :index = "item.authId+''">
                  <template slot= "title"><i class= "el-icon-location"></i></template>
                  <span slot= "title">{{item.authName}}</span>
              <div v-for= "secItem in item.children" :key = "secItem.authId"> 
                <el-menu-item :index= "secItem.authPath" >{{secItem.authName}}</el-menu-item>
              </div>
                
              </el-submenu>
          </div>
          <!-- <el-submenu>
            <template slot= "title"><i class= "el-icon-location"></i></template>
            <span slot= "title">首页</span>
            <el-menu-item index= "/home" >首页</el-menu-item>
            <el-menu-item index= "/PersonInfo">用户信息</el-menu-item>
          </el-submenu>
          <el-submenu >
            <template slot= "title"><i class= "el-icon-setting"></i></template>
            <span slot= "title">定制功能</span>
                  <el-menu-item index= "/Customization">定制流程</el-menu-item>
                  <el-menu-item index= "/FileUploadDownload">试卷课件管理</el-menu-item>
                  <el-menu-item index= "/Attendance">考勤</el-menu-item>
          </el-submenu>
          <el-submenu >
            <template slot= "title"><i class= "el-icon-user-solid"></i></template>
            <span slot= "title">用户管理*</span>
              <el-menu-item index= "/Teacher">教师管理</el-menu-item>
              <el-menu-item index= "/Course">课程管理</el-menu-item>
              管理哪个教师教什么课 -->
              <!-- <el-menu-item index= "/Teaching">授课管理</el-menu-item>
              <el-menu-item index= "/Role">角色管理</el-menu-item>
              <el-menu-item index= "/Authority">权限管理</el-menu-item>
          </el-submenu>
          <el-submenu >
            <template slot= "title"><i class= "el-icon-s-custom"></i></template>
            <span slot= "title">班级授课信息</span>
                        <el-menu-item index= "/Student">学生管理</el-menu-item>
                        <el-menu-item index= "/Grade">成绩管理</el-menu-item>
          </el-submenu> -->
  
    </el-menu>
</template>
<script>


export default{
name:"Aside",
data(){
      return{
          authorityList:localStorage.getItem('authorityList') ? JSON.parse(localStorage.getItem("authorityList")):[]
      }
},
props:{
    isCollapse:Boolean,
    logoTextShow:Boolean
    },
    methods:{
      handleRoute(index){
        console.log(index)
        console.log(this.$router.options.routes)//显示index.js里面的所有路由及其子路由
        this.$route.fullPath.split("/")

      }
}
}

</script>
<style scoped>

</style>